﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using Entity;
using IDAL;

namespace EFDal
{
    public class AdmUserDal : BaseEFDal<AdmUser>, IAdmUserDal<AdmUser>
    {
        public bool ChangePassword(AdmUser entity, string password)
        {
            using (var Entities = new PizzaBaseContainer())
            {
                var obj = Entities.CreateObjectSet<AdmUser>();
                entity.LoginPwd = password;
                entity.ModifyDate = DateTime.Now;
                obj.Attach(entity);
                Entities.ObjectStateManager.ChangeObjectState(entity, EntityState.Modified);
                return Entities.SaveChanges() > 0;
            }
        }
    }
}
